package main

import (
	"fmt"
	"myetcd_demo/server"
	"time"
)

func main() {
	endpoints := []string{"localhost:2379"}
	ts, err := server.NewEtcdStruct(endpoints)
	if err != nil {
		fmt.Println("new etcd failure,err:", err)
		return
	}
	err = ts.RegisterServer("/phpServer/user", "127.0.0.1:9501", 30)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("put data ok")
	err = ts.RegisterServer("/phpServer/shop", "127.0.0.1:9502", 30)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("put data ok")
	time.Sleep(300 * time.Second)
}
